package com.zhiyou.homework.pojo;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

@Table(name = "grade")
public class Grade{
    @Id
    private Integer gid;

    private String gname;

    @Column(name = "ghead_teacher")
    private Integer gheadTeacher;

    public Integer getGid() {
        return gid;
    }

    public void setGid(Integer gid) {
        this.gid = gid;
    }

    public String getGname() {
        return gname;
    }

    public void setGname(String gname) {
        this.gname = gname == null ? null : gname.trim();
    }

    public Integer getGheadTeacher() {
        return gheadTeacher;
    }

    public void setGheadTeacher(Integer gheadTeacher) {
        this.gheadTeacher = gheadTeacher;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Grade grade = (Grade) o;

        if (gid != null ? !gid.equals(grade.gid) : grade.gid != null) return false;
        if (gname != null ? !gname.equals(grade.gname) : grade.gname != null) return false;
        return gheadTeacher != null ? gheadTeacher.equals(grade.gheadTeacher) : grade.gheadTeacher == null;
    }

    @Override
    public int hashCode() {
        int result = gid != null ? gid.hashCode() : 0;
        result = 31 * result + (gname != null ? gname.hashCode() : 0);
        result = 31 * result + (gheadTeacher != null ? gheadTeacher.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Grade{" +
                "gid=" + gid +
                ", gname='" + gname + '\'' +
                ", gheadTeacher=" + gheadTeacher +
                '}';
    }
}